﻿using System;
using HouseKeeperCore.Elemental;

namespace BillSplitter
{
    /// <summary>
    ///  The base event that all bill splitter event should inherit
    /// </summary>
    public class BillEvent : Event
    {
        #region Constructors

        /// <summary>
        ///  Instantiates a bill event with specified time
        /// </summary>
        /// <param name="time">When the event happens</param>
        public BillEvent(DateTime? time)
            : base(BillHelper.EventIdGenerator.Assign(), time)
        {
        }

        /// <summary>
        ///  Finalises the bill event
        /// </summary>
        ~BillEvent()
        {
            Dispose(false);
        }

        #endregion

        #region Methods

        /// <summary>
        ///  Disposes of unmanaged resources of the bill event
        /// </summary>
        protected override void DisposeUnmanaged()
        {
            BillHelper.EventIdGenerator.Unassign(Id);
        }

        #endregion
    }
}
